#include <stdio.h>
#include <unistd.h>
#include <stdbool.h>
#include <string.h>

int strlenc(const char* s, char c);
void _strcpy(char* d, char* s);

int _main(void) {
	printf("\x1b[38;2;0;204;255m");
	const char* home = "/home/orchy";
	char _cwd[1024];
	getcwd(_cwd, 1024);
	char* cwd = _cwd;
	char arr[64][256];

	if (cwd[0] == '/' && cwd[1] == 'h' && cwd[2] == 'o' && cwd[3] == 'm' && cwd[4] == 'e' && cwd[5] == '/' && cwd[6] == 'o' && cwd[7] == 'r' && cwd[8] == 'c' && cwd[9] == 'h' && cwd[10] == 'y') {
		if (cwd[11] == 0) {
			printf("~/");
			return 0;
		}
		cwd += 10;
		cwd[0] = '~';
		cwd[1] = '/';
	} else {
		printf("/");
		if (cwd[1] == '\0') {
			return 0;
		}
	}
	size_t i = 0;
	char* x;
	strncpy(arr[i++], strtok(cwd, "/"), 256);
	while (1) {
		x = strtok(NULL, "/");
		if (!x) break;
		strncpy(arr[i++], x, 256);
	}
	*((char**)arr+i) = 0;

	i = 0;
	while (arr[i]) {
		if (arr[i][0] == '\0') {
			printf("%s", arr[i-1]+1);
			return 0;
		} else if (i != 0) {
			printf("/");
		}
		printf("%c", arr[i][0]);
		i++;
	}
}
int strlenc(const char* s, const char c) {
	size_t i = 0;
	while(s[i++] != c && s[i] != '\0');
	return i-1;
}
void _strcpy(char* d, char* s) {
	size_t i = 0;
	while(*(d+i++) = *s+i);
}
int main(void) {
	_main();
	printf(": ");
}
